<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>登录</title>
<link rel="stylesheet" type="text/css" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="/static/css/login.css">
</head>
<body>
	<div class="wrapper-background" style="width: 100%;height: 1080px;">
		<img id="bgImage" height="100%" width="100%">
	</div>
	<div class="wrapper">
		<div class="wrapper-contont">
			<div class="contont">
				<form class="layui-form" action="">
					<h3>登录</h3>
					<div class="layui-form-item">
						<label class="layui-form-label"> <i class="layui-icon layui-icon-username icon-style"></i>
						</label>
						<div class="layui-input-inline">
							<input type="text" name="userAccount" required lay-verify="required"
								placeholder="账号/用户名/手机号" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"> <i class="layui-icon layui-icon-password icon-style"></i>
						</label>
						<div class="layui-input-inline">
							<input type="password" name="password" required
								lay-verify="required" placeholder="请输入登录密码" autocomplete="off"
								class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn layui-btn-warm btn-style" lay-submit
								lay-filter="login">登录</button>
						</div>
					</div>
				</form>
				<div class="layui-form-mid layui-word-aux">忘记密码</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="/static/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="/static/plugins/layui/layui.all.js"></script>
<script>
	layui.use(['layer','form'],function(){
		
		var layer = layui.layer;
		layer.ready(function(){
	    	getBackgroundImg();
	    }); 
		
		var form = layui.form;
		//监听提交
		form.on('submit(login)', function(data) {
			var params = data.field;
			$.ajax({
				url : "/author",
				type : "post",
				data : params,
				timeout : 2000,
				beforeSend : function () {
	            	this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] });
	          	},
				success : function(data) {
					if (data.success) {
						 location.href = "/hzdh/account/index/view";
					}else{
						layer.msg('账号或者密码错误,请重新登录!', {icon: 5});
					}
				},
				complete : function () {
					layer.close(this.layerIndex);
				}
			});
			return false;
		});
	 
	});

	function valiteForm(params){
		$.ajax({
			url : "/author",
			type : "post",
			data : params,
			beforeSend : function () {
            	this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] });
          	},
			success : function(data) {
				layer.close(this.layerIndex);
				if (data.success) {
					
				}else{
					
					layer.msg('不开心。。', {icon: 5});
				}
				
			},
			complete : function () {
				layer.close(this.layerIndex);
			}
		})
	}
	
	
	
	// 获取每日必应官网背景图片
	function getBackgroundImg() {
		$.ajax({
			url : "/login/image",
			type : "post",
			dataType : 'json',
			success : function(data) {
				var img = "http://s.cn.bing.net" + data.images[0].url;
				$('#bgImage').attr('src', img);
			}
		})
	}
</script>
</html>